package cn.ixinjiu.libraryMangement.service.impl;

import cn.ixinjiu.libraryMangement.dao.IUserInfoDao;
import cn.ixinjiu.libraryMangement.dao.impl.UserInfoDaoImpl;
import cn.ixinjiu.libraryMangement.entity.UserInfo;
import cn.ixinjiu.libraryMangement.service.IUserInfoService;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by XinChen on 2023-05-08
 *
 * @TODO
 */
public class UserInfoServiceImpl implements IUserInfoService {
    // 多态写法：父类接口new子类对象
    private IUserInfoDao userInfoDao = new UserInfoDaoImpl();

    @Override
    public UserInfo login(String email, String password, int loginType) throws SQLException {
        return userInfoDao.login(email, password, loginType);
    }

    @Override
    public int register(UserInfo user) {
        return userInfoDao.register(user);
    }

    @Override
    public List<UserInfo> userList() {
        return userInfoDao.userList();
    }

    @Override
    public int count() {
        return userInfoDao.count();
    }

    @Override
    public int userInfoDel(int id) {
        return userInfoDao.userInfoDel(id);
    }

    @Override
    public int userInfoUpd(UserInfo user) {
        return userInfoDao.userInfoUpd(user);
    }

    @Override
    public UserInfo getUserInfoById(int id) throws SQLException {
        return userInfoDao.getUserInfoById(id);
    }
}
